Cleaned up core.php