more work on derivation
fixed merge conflicts