Replaced everything, added current monitor and state variables.