move common js code to a dedicated js that will be called from multiple actions in kyu controller