Add getLayers and test it. fixes #222