refactored some backend api functions