Minor fixes

- Minor fixes/refactorements to the code
- Added additional tests