First refactor

Everything is described in the commit history ;)