code cleanup

added comments
started added threading for doing part 2