big commit, several problems solved, may or may not get around to cleaning them up