Fixed front end and reading and writing to DB