Implemented most of expression derivation.