Added optionality to not use memory