Refactor & beautify