Slight optimization
Check for existence of a cpecified table name in DB
Employed some new data checks to improve overall security and stability