got a working version, got to clean it up