Fix the messy and incorrect inheritance