Initial working (hacky) version