Refactor + tests
lmpreftest