pushing the previous optimizations a bit further