[refactor] Major refactor