refactored code for galaxy visualizer to make self commenting after rebasing