implemented basic compose function.