Added foo() and attempted to improve readability of code