Moved to class. created function to insert