Changed Forloops in main method: added enumerations to simplify steps