Fixed AJAX errors. Added message passing.