Code Cleanup

Moved the #table.empty() to the html page to keep the object pure.
Removed some unused alert boxes.