Almost ready to release v0.4.0
Refactored some stuff.