Refactored & updated