Ugly Second Commit

The general logic works