refactored and added post detail controller