refact orm