TR-10 initial commit, needs additional testing of border cases