Fixed inheritance bug, added comments.