Added modules, e.g. debug and some re-factoring.