strip trailing newlines
implement pos()