add hand logic and tests