Updated code to run on larger computer, memory errors are an issue