shaped up main function to look more presentable