Added front end javascript and numerous backend fixes