tests + some improvements