- Added more documentation
- Placed the shell code in a separate function