added alert, cleaned code, cruft