this code is much simpler and will work find with model inheritance