added cstdlib for exit function