Refactor to fix bindings