derivatives

written and undergoing tests.