redundant code removed
added debug consoles