MISC - refactor some code for front page