Added additional functionality, but untested.