Thanks, everyone! The mechanics are basically done though the user interface needs improving.