works, problems in main