modified the php structure for better code management