Refactored some stuffs