Added more bug fixes and code for pushing data to the DB.