Added Brian's codes
Merged codes from Brian for GUI submission.
test
test