changed: pass by const reference
changed: move static helpers to static functions