cleaned up client.cs and added settings object for increased testability