trying to increase speed and save memory
further tidy
tidy