Refactored one of previous pull requests a little