Implemented master version of main method