code quality modifications + test for application context