still not working quite right yet, but i think it's close