removed wonky behavior and poor code