Removed wall of code and redistributed to function.php