First solution for #13, but more convienient API will be needed.