documentation and code cleanup for LegendAPI module