Cleaned up code and got first search working