Add reference type, implement proper validatoin and tests