Added legend and moved ajax loader