some refactoring on api, also started work on admin section