major refactor, major speedups, major major