works. but still exceed time limit..