version with added stack growth protection
This is the final version of project 3