Fix type class reference for generated methods. Only create bind/unbind if flag is set. Refactor to use only one creation method.