refactor compatibility layer and progress on sha