Only send capabilities discovery query if one hasn't already been sent
Split utility functions into util.js
Pull caching code into a separate class