some new code and fixes