fix trailing spaces & formatting issues