pattern matching with modules and functions