STH fully functional, 4 times faster than Python implementation.