Cache improvments

Include all cacheFixes branch with other improvements. 
Please review.