Improved springy panning on edges and cleaned code.