New unit tests + code update