re-wrote as module