Added auto direction change, fixed imp. fucntions.