First working version for single GPU. Some optimization done.