Deleted trailing spaces and added tests

Test Plan:
<see below>