changed behavior when fields are empty
added method for inserting data