revamping all code