Implemented main function and reflected other functions implementations.