refactoring, made pseudocode text file with plans for js file overall