first hack at sorting plans