rewrote without using 'with' keyword for parsing