renamed
minor tweaks to code