Refactored code to replace MotionScript with MotionScript2013