Refactored functions added header files.