Refactoring var-statements
Added more tests