major changes to code readability