extracting function to main for all to use and working on sanger CRUD