Removed excessive parenthesis
Fixed error in length algorithm