added new logic to main