Working UCS, modified genericSearch to be compatible with UCS by keeping track of costs