logic improvements