got something basic working, but needs more testing