updated legend loading slow problem, formatted code, other