Fixed Tests
Improved code quality