Fixed and completed functionality to edit posts

Had a tough time to fix the edit functionality of posts but finally it's
here without a glitch ! Cheers !