Using inheritance to make the code more logical