first try of manipulating registers directly instead of the file interface. completely untested.
clarified a comment