Motor controller function added