Added copyright info. Reformatted code a bit.