change class to function