Resolve Paul's comments to clean up the code