Version 0.6

Refactoring and other fixes.