cleanup repository
free variables and update to coding style
find existing variable if necessary