final version after adding GCM