finsished base function