continued work on porting rigs.js code