Merging of pmishev and falahati changes

#2  + tests now passing and dependency to php 5.4 dropped