Tidying up, testing and eliminating unnecessary println()s.