Refactor/saving code