Cleaned up code and made it work better on small screens