clean up logic
add file as first param