Refactor and more stuff