Added control for serial and cleaned up