removed duplicated code, removed commented code