adding roots code