cleaned up derivative to not include the chain rule