Use correct return type as variable
Added copyright
Reformat code
Rearrange code