problems with braces, copied code