Refactored Legend.js a bit to push down ajax calls outside of init
Further refactoered legend to give more control for how each type of item is processed