Added missing function and event binding