Refactored parts of the flow.
Merge pull request #54 from Gonthim/master

Refactored parts of the flow.