Use AbstractModel as base class and other small fixes