Rewrote code to include Vuoltennehoew's restrictions.