removed some caching booleans and added handler code