A big change in the program structure

Removed duplicate definitions of same structures and made the code to be readable better