implemented automatic detection of paramter and variation count, implemented new modes