some refactoring with matts help