Debug mode

Some code clean up