simplified the php content with functions