if with begin working