added cmndline interface; 9 sec on 10^6 array