Init and key events in functions