fix duplication by passing functions
add TODO