Updated some CRUD logic with tests