Refactored so that id's an be autogenerated