Cleaned up core.php file