lotsa tiny bug fixes
begin transition to Swift