Separated initialization of memory for GPU

Still a lot of work to do!