More readable main function code