psr0 changes and some performance improvements