removed exit calls and printf statements