Reorgnanize and comment frontend