Cleaned up front-end code a bit