You timer probably needs a neutral which may not be in the box. It is also likely able to be used as a three way switch. That would explain all the wires.