code optimized for gtsrb wrapper