Binding fixes, refactoring