Added sorting by y coordinate when rendering.