Fixed IntelliJ analysis suggestions. Changed declarations to be final where appropriate