logic simplified #190 & #191