Add memory limit
Add logging