Refactored code && fixed typos