refactor for future porting into github pages