re-worked code for profile