New featues and lots of refactoring, adding more tests
Fix indentation: use 4 spaces in all files