updates with refactoring and api security