Finished unit tests + some issues fixed