version 0.6 - completely refactored