Re-arrange helpers, remove duplication code, update code for Rubocop