PSPI-24 Move code around, unit test added