Improve parameter splitting and simplify code