ajax: manage dependencies; adjust code format