Refractor

Seems ok for the moment