Major update (Part 1)

This update not only adds new features, but also cleans the current
code.