finish all the functionality of main page