a bit of smart logic