Horrible implimentation of front-end display code - Really needs refactoring