Add layout. Fix phpdoc. Fix misc bugs.
Fix indent and small refactoring.
Merge pull request #9 from miramir/master

Add layout. Fix phpdoc. Fix misc bugs.