Added tests and some more fetures

Add
Refactoring