Refactored a litle