Wrote pill spawning code.