ugly SGCT implementation working