restructure, added ending hand functionality