Added logic to display posts