Did few minor changes. Moved the code snippet to a seperate file.