fixed side and refactor