Refactor Variables service to use array variable format. Fix variable saving