some minor code optimizations