some refactoring, add delete method and api keys