model methods and tests