Fixes and big optimizations for week 3