Updated modifySelection. Still needs testing