need to implement layer switching