Main.java reworked