fixed errors in sub-expressions and added Expand() method