Changing main so that it returns the result of any module function.

Also adding more test coverage