Cleaned up trailing slash logic