Restructure and refactor