add if block to main method