Refactor to new guidelines and structure