refactor profile loading