Significant refactor of module