Clean up + formatting + fix potential memory leak with resource location on item render