slowly fixing cubism

need to move library graph logic to javascript, and consolidate js functionality.