added getLayer() and modified the layers access.