more attempts to sort out logic