changed query in timeTable to use database class