changing names and things for clarity
fixed the formula for determining 'b'. I accidentally used slope.x instead of the line's 'xpos' value.