Optimized code a bit. Only objects within the visible field are drawn.