Removed extra function and if statement.