Refactor to use packages.

This is prior to changes to use matching service for login process.