Refactored everything, new style of implementation