added php tag and reordered functions