bug fixes, improvements, moving to phpunit