Refactored certain functions which update and prepare had in common in helpers script.