Revert "some modifications and optimizations"

This reverts commit b2f54cfaf0d52baa2ee9c4ed7fafebb2910c4736.