Improved organization and added more tests.