Refactored models and client