Added back composition handling code
Updated pseudo code