Added automatic peripheral detection and correction, added stuff to monitor.