got rid of the redundancies but it doesn't work quite right