implemented new loading method. added more pragma statements to make code easier to follow.