Refactor imprint a bit to clean up some of the code.