Adds some tests + fixes some bugs