Resolved almost every warning

There were quite many warnings mainly because of
1) Duplication in source code
2) Impropoer naming of the files
3) Missing header file for memset.