Added support for "phaseAttributes" and simplified code