Psr2

refactored as close as possible to PSR2 without changing the API.