Updated for new additions to function.