transferred completely to individual functions instead of a single main function