Added ability to delete posts, removed duplicate code