Merge "Module and states code refactor"