Amplified version for UIUC CS105 assignment