rewritten paper format handling, fixes #7