refactor to make it more FP like
Merge pull request #10 from xilix/dev

refactor to make it more FP like