simplified implementation of var