refactored it a bit, some methods are better distributed