Synchronising this code with the db layer