implement in a simpler way