refactored table creation to use jquery