tidying up main function