rm debug line
mv function
make fn name not global
factor out duplicate fn
add missing semicolon
stop polluting global namespace
remove unused var