Some improvements regarding type detection for #6
fixes #7 with homework №6