Fix & Refactor internal unit tests