Refactored code and tweaked form to display a bit nicer