Solution to the second softwire coding challenge