started refactoring Shib code #963