code and api cleanup - md sources