some cleanups and I hope closer to making it work