Legend Improvement: Widows and Orphans, Formatting improvements, Bug fix

Sorry, to have a rather large pull request, but this is fixing a few problems:

- MapPrinterServlet where I got a NullPointerException is now fixed.
- Formatting has been done with the IDE to get a consistent style throughout the Legends Block code.
- The widows and orphans problem is solved, at least for most cases. This might need some more testing with more environments.