Added a timeout for the motor. Not sure if checking the states is done properly.
Added a restart for the computer if the processes have been killed 5 or more times.