More granularity + bug fixes. not tested yet so not in master
Merging into master, should work
some fixes