Refactored a little bit of stuff