master various improvement and correction, add caching capabilities