completed the implementation of both the functions