separated timer and main function, added timer header file