Dependancy injection

Added mock test connector and some tidy up.