remove log
move the function outside of controller