Fixed up code