improved algorythm
improved AJAX
added docs to tests, so you can see func in browser