A bit of refactoring, added pixelsFromLeft, pixelsFromRight.