CN-26: Little refactor, fixed bug with active layers when changed