Additional changes include removing useless code and making some utility methods not reliant on Context