study and make some better code