cleaned up the injection code, to make it clearer