Fixed the code. Still has regressions