Fix #2 -- working with ajax requests
Added some tests to avoid stupid mistakes like #2