some debug code removed