added options and proper logging