more logic (untested)