added gates and keys