seperated a lot of the php code into seperated files