make code more readable by extracting methods