version 2

rewrote the modules to use recursive functions and also add more
functions. the main module is only 3/4 written.