Minor fixes and added the code in itself to the post