Changed to OO PHP and added MVC architecture