written the required functions