Add offline search / Refactor some codes