Deleted unnecessary values from  array
Changed table existence mechanism
Deleted unneccesary connection variables
Modified error mesage in add_record case