rewrote getRecord. Still have an infinite loop