original functionality restored in module pattern structure; needs comments. will review code later.