Huge code update to follow pip8 conventions