it works- flattened functions into main