Edited Main.java to allow polymorphism.