Refactor and restructuring modules