Added ajax and some more private functions