Cleaned up an if-then statement