Prime: refactor