reorganized and added loading logic and new style