Changed to if/else for code clarity