Abstracting AJAX functions. Cleaning up whitespace.