Fully tested on PHP5.6