Refactor/coverage layers

It's working but layer queries needs to be checked.