added copyright info and reformat code