Refactored stuff and added a client