Rearranged the files

Rearranged files & documented code to understand easily.