finish compose function