sorta working, needs cleanup