added options and input safeguards