Various improvements & optimizations