update pure php implementation