refactored item displaying markup and javascript