Changes to laymode to work properly