Some code fragments that might be useful