added tests + cleanup