Restructure, copy from stackedfortress