finished castle function