Refactored front end

Refactored front end code so it does not look like a mess and the code is easier to follow. Still has the same features. Still needs some work for frontend-backend communication. Updated documentation to reflect changes.