Tiyding up some code