Further logic improvements