Moved helper function int homeHandler