Added a check so that only things on screen are rendered