merge old phpwind code