sub main modified