Updated code for latest Crystal version