Add memoisations to functions