Implemented more precedence logic. Identified segfaults.