Added feature to copy information back to the dem[] data structure... Work in progress