implemented gcm from tutorial completely (?)