add some functions and new pattern into modules