Refactored files
Added new tests.