should probably be removed or replaced witha debug printf or something