mostly works with a few bugs