split into two classes, build and search