Code cleanup

Code cleanup, added separate debug class