code and api cleanup - viewdef source