split some code to modules