Cleaning up if/else conditional