cleanup & optimizations