implementing the functions