Create main program with options parsing, fix tests performances bugs