better way to split and join