little optimization and gem file modification