tiny performance improvment by caching unexplored actions
compile with O2 flag
minor changes