Implemented Riddler's method