Could be cleaner but overall ok