finalising code