Separate logic into methods