cleaned up main php file