refactoring to support test paper