add delete method and refactor select method