Faster solution