Merge with Andrew's Solution