clean up code in details controller