moves functions into modules

finishes chapter of six of LYAHFGG