Client refactoring and updated features. Not yet stable/tested.