Little fix and refactor