Rewritten to better adapt to different resolutions + cosmetic changes