added a RIG class

minor changes, refactorings, and added a RIG class