major function finished