Simplified return statement

Added copyright
Reformatted code
Rearranged code