Moved and refactored, preliminary commit before deletion of some stuff