Refactor profile API