Refactored some methods.