simplified main function