app logic improved