Refactored code.
Updated to v0.3.1