refactored abit to my own style