first version with better inout support
first version with better inout support