extracting layer model from layer widget; renaming things to better organization.