Improve samples saving; begin implement caching