Updated so it workes better on different window sizes.