Refactor and add customize command function