Refactor profile parsing.