updated if-else according to java conventions