merged algorithms into a single file, merged some repeated sections of code