Fixed swap and merged in Sylvan's changes