Some fixes and new ways to optimize.
Merge pull request #18 from Alegend45/master

Some fixes and new ways to optimize.