Remove static calls
Add tests.