Clear all tables, resizing table fixed

Other minor changes: padded local time query with zeros, fixed event
query to print out event ID if not given, and other minor/cosmetic
refactoring.