Copying functionality added in the sample project to source.