Implemented all the functions except extract