changed the order in which functions are declared