Updated code so that it can be complied and run.