Refactor

Wow, that's some fancy shit :)