made test flag better, made logging clearer