adjusted the code