Modularize frontent code