refactored code for galaxy visualizer to make self commenting