Remove redundant function from main