Refactor with new modules. Still not perfect...