Front page script refactor