made main method's code more readable