Rendering bug, find a way to optimise positioning code