Refactor Lakka action code