added call to -trap- and removed unused code