Implemented if/else if/else functionality. (Untested)