Fixed errors from earlier refactor