modified Logic.java