Started implementation of margin handling, and lots of work on the example page