revamping the code