Refactor the code
Refactor and modify tests
Merge pull request #97 from bem/tests

Tests