updated crafty, reformatted code