add otp application support and make the insert function more flexible