changed box logic