Refer to write up : https://www.writelatex.com/read/kqftbctckpwn