Merge pull request #1 from ckd/master

formatting and some modifications
newInstance and fixes
PHP 5.3 Compatibility