mid ground between fig and php implementation