Added front end code and started refactoring it.