refector practice logic