added id-based search, -i, refactoring