Refactor api methods a bit