Adding gear management code.