rewritten in pymel