if in main should work correctly now. added some prints.