SN-28 Refactor code