Rearranged some processes and addded comments for further explination