A 'fi' was needed in the last if statement.