Which muscles form the hamstrings? How do they function together?