Motor spinning fix, code cleanup