How a good family environment improves academic performance