Tidied up front end and pulled out some code that's not required any longer.