somewhat better solution to prev commit.