added option parser and adapted main.cpp