Cleaned up, added client code and end-to-end test