Added tests. Fixed few minor issues found while writing tests.

Added tests. Fixed few minor issues found while writing tests.
Fixes #5 
The question is: is it a good idea to make setting protected attributes a part of contrtact for subclasses. I don't know (shame on me). Asked few experienced guys, they told "yes, it's fine".