Much better optimization, still needs work