added code to main