refactor argument handling and support special char