Additional code for random effects structure and rm Rproj