Restructure main file