testing out some element reference stuff for matrices. doesn't seem to affect release code generation at all
moving definitions to good places