correcting logic, not using reverse