fixed major bugs in database, yet to add validations