Consolidated into one Main function