Fixing margin position
Working dev ordering of images

Before the events are called this sorts and positions the images
correctly.
Cleaning up variables and comments

More consistent variable names and less debug code