more enhanced logic -- this is unwieldy