Added remaining the last part of the code (Functions)