Updated code for new features.