Some refactoring, I think
Reference