gramma: refactored