Fixed server errors and formatted code