Refactored the details page to reduce the amount of php