tidied up the main function, moved timer to inside the if __name)) = = main ()