Minor code refactorings also done.
#17 Tests
Updated specs.