refactored next/previous, added search