Modified function. Changed to class. Added PHPUnit tests.