remove debug code, make variables const