mostly working... still need some fixes