Updated outdated code, fixed minor errors