some cleanup and code documentation
Merge branch 'release/v0.4.0'