Remove redundant code and more comments