Extracting code into separate classes