Updated code to new specs