move subroutines into module.