Some basic refactoring was made.
Added debug module.