Updated first function