Adding a Profile factory and using it in the listener

Unit tests included