refactored testing & api server