Changed the data classes and added saving to database