finish major function