small fix
restructered code
small fixes, rename of variables
rename variables