moving to pure python implementation