correct if statement.
add timinig logs