Refactor, adding old functionalities from previous build