Restructured application and integrated 'debug' for debugging purposes.