generlized shared code between screen sizes