Refactor lookup command and partially fixed #72.