Finally got rid of the 'if'