Updates to work with different sizes.

Sometimes crashes :(