functionized

made function