Refactor big methods into multiple smaller ones

Fix some notifications from 'Reek'