refactoring and documentation for innerProducts