Refactor to allow different types of layer data.