Add clearer close action, refactor base layer code