bug fixes
better simplifications