an implementation of two functions