Removed redundant function and reformatted code.