Some refactoring of the injection code.
#72: Haha! Hasn't been thoroughly tested though.