refactor to hopefully make finding solutions faster