Working version, although with some known issues