Moved expand current module code to its own function.