Added command line options + some other changes