add remove option
stop using trap
fix code style
only run main function in direct invocation