Added working version (quickly thrown together based on trailing spaces plugin)