Change BFS, DFS and IDDFS so that goal check is performed on expansion.

This commit also includes more whitespace changes, and removes some
unnecessary files and code.