added new modes and started using variable length arguments