cleanup of layermodule - test coverage and minor bug fixes