simplified, removed unused code