Code refactor and some new features.