Refactored a bit more