Fixed pixel placement

going to clan up code and add some comments as well