now basically working, bug exists though