Better tests + fixes