replaced defstruct with defrecord