Added some tests + fixed problem where ready was called twice (and early).