Better parsing. Bugs fixed