Refactored some stuff.