added default statement handling, still not perfect