Modified for Non-GUI environment.