refactoring code and fixing some errors
tired of manual testing, so now PhpUnit is installed and running. Still requires some fixtures as its currently using the live db