Refactor naive implementation

Fix trailing whitespace