updated mains, new functions