Implemented automatic settlement. Fixes #13