Updated profile handling to be reusable