Add plugin test
Add comment
Refactor for testability
Refactor constant handling
Use logger