added caseblock parser + refacto to pass less arguments in func