Added tools module, code cleanup