Added Swap and Key classes and high level logic