ri added, some cleanup