making sub main less complex