Implementation and testing of the module function