implementation for functions