Major improvements to generation of profile