some optimizations
cleanup