Initial version...some bugs to fix still