simplify spectrum code