Layer selector implementation and fixed issue #1