Converted parts of the client to scala