added complex derivation